package com.xuecheng.base.exception;

/**
 * 统一异常处理
 *
 * @author jiang zhongxun
 * @create 2023-03-11 10:22
 */
public class XueChengPlusException extends RuntimeException {

    private static final long serialVersionUID = -1453166420497047842L;

    private String errMessage;

    public XueChengPlusException() {
        super();
    }

    public XueChengPlusException(String errMessage) {
        super(errMessage);
        this.errMessage = errMessage;
    }

    public String getErrMessage() {
        return errMessage;
    }

    public void setErrMessage(String errMessage) {
        this.errMessage = errMessage;
    }

    public static void cast(String errMessage) {
        throw new XueChengPlusException(errMessage);
    }

    public static void cast(CommonError commonError) {
        throw new XueChengPlusException(commonError.getErrMessage());
    }

}
